package main

import (
	"fmt"
	"io/ioutil"

	"github.com/gomodule/redigo/redis"
)

func main() {
	c, err := redis.Dial("tcp", fmt.Sprintf("%s:%d", "127.0.0.12.9", 6379))
	if err != nil {
		panic(err)
	}
	var data []byte
	data, err = ioutil.ReadFile("double.lua")
	if err != nil {
		fmt.Println("load double.lua error")
		return
	}
	script := redis.NewScript(1, string(data))
	script.Load(c)

	if false {
		c.Send("set", "score", 1000)
		rpy, _ := redis.Int(script.Do(c, "score"))
		fmt.Println(rpy)
	}
	if false {
		rpy, _ := redis.Int(script.Do(c, "alen", 1000))
		fmt.Println(rpy)
	}
}
